<?php
/*
查找商品数量
*/
include('../conn.php');

// 需传参数 
$goodsid = $_REQUEST['goodsid'];
$fTitle = $_REQUEST['fTitle'];
$sTitle = $_REQUEST['sTitle'];
// 需传参数 end

if ($goodsid != '') {
	if ($sTitle != '' && $fTitle != '') {
		$query = mysql_query("select number from goodsselect where goodsid=".$goodsid." and fTitle='".$fTitle."' and sTitle='".$sTitle."'");
	}elseif ($fTitle != '') {
		$query = mysql_query("select number from goodsselect where goodsid=".$goodsid." and fTitle='".$fTitle."'");
	}else{
		$query = mysql_query("select number from goods where goodsid=" . $goodsid . " AND shangjia=1");
	}
	$goods = mysql_fetch_assoc($query);
	$goods_number = $goods['number'];
	$arr = array('code' => 200, 'msg' => '查询成功', 'goods_number' => $goods_number);
}else{
	$arr = array('code' => 400, 'msg' => 'goodsid不存在' );
}
echo json_encode($arr);